package com.android.zmusic.musicplay;

import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

public class MusicData implements Parcelable {
	
    public final static String KEY_MUSIC_DATA = "MusicData";
	
	private final static String KEY_MUSIC_NAME = "MusicName";
	private final static String KEY_MUSIC_TIME = "MusicTime";
	private final static String KEY_MUSIC_PATH = "MusicPath";
	private final static String KEY_MUSIC_ARITST = "MusicAritst";
	
	public String mMusicName;	
	public int  mMusicTime;	
	public String mMusicPath;
	public String mMusicAritst;
	
	

	public MusicData() {
		mMusicName = "";
		mMusicTime = 0;
		mMusicPath = "";
		mMusicAritst = "";
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		Bundle bundle  = new Bundle();
		bundle.putString(KEY_MUSIC_NAME, mMusicName);
		bundle.putInt(KEY_MUSIC_TIME, mMusicTime);
		bundle.putString(KEY_MUSIC_PATH, KEY_MUSIC_PATH);
		bundle.putString(KEY_MUSIC_ARITST, mMusicAritst);
		dest.writeBundle(bundle);

	}
	
	public static Parcelable.Creator<MusicData> CREATOR = new Parcelable.Creator<MusicData>() {
		
		@Override
		public MusicData[] newArray(int size) {
			// TODO Auto-generated method stub
			return new MusicData[size] ;
		}
		
		@Override
		public MusicData createFromParcel(Parcel source) {
			
			MusicData data = new MusicData();
			Bundle bundle = new Bundle();
			bundle = source.readBundle();
			data.mMusicName = bundle.getString(KEY_MUSIC_NAME);
			data.mMusicTime = bundle.getInt(KEY_MUSIC_TIME);
			data.mMusicPath = bundle.getString(KEY_MUSIC_PATH);
			data.mMusicAritst = bundle.getString(KEY_MUSIC_ARITST);			
			
			return data;
		}
	};

}
